package cn.edu.bupt.thymeleaf.examples.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class SubscribeController {

    @GetMapping("/subscribe")
    public String showSubscribePage() {
        return "subscribe";
    }
    
    @PostMapping("/subscribe")
    public String processSubscribe(@RequestParam("email") String email) {
        System.out.println("Subscribed email: " + email);
        // 实际项目中这里应该保存到数据库
        return "redirect:/";
    }
}